﻿using YaTools.Yaml;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace YaTools.Yaml.UnitTests
{
    /// <summary>
    ///This is a test class for ErrorIdTest and is intended
    ///to contain all ErrorIdTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ErrorIdTest
    {
        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test dumper which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get { return testContextInstance; }
            set { testContextInstance = value; }
        }

        #region Additional test attributes

        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //

        #endregion

        /// <summary>
        ///A test for ErrorNumber
        ///</summary>
        [TestMethod()]
        public void ErrorNumberTest()
        {
            ErrorId target = new ErrorId("YA100");
            Assert.AreEqual("YA100", target.ToString());
            Assert.AreEqual(100, target.ErrorNumber);
        }

        [TestMethod()]
        [ExpectedException(typeof (FormatException))]
        public void ErrorNumberTest2()
        {
            ErrorId target = new ErrorId("YAC00");
            Assert.AreEqual(100, target.ErrorNumber);
        }


        /// <summary>
        ///A test for GetMessage
        ///</summary>
        [TestMethod()]
        public void GetMessageTest()
        {
            ErrorId target = new ErrorId("YA100");
            Assert.AreEqual("Unexpected condition in YAML parser ABC  (YA100)", target.GetMessage("ABC"));
        }

        /// <summary>
        ///A test for op_Implicit
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof (ArgumentException))]
        public void op_ImplicitTestError()
        {
            ErrorId id = "JJ001";
        }
    }
}